/**
 */
package de.hwrberlin.remo.model.impl;

import de.hwrberlin.remo.model.ElementState;
import de.hwrberlin.remo.model.LinkObject;
import de.hwrberlin.remo.model.RemoModelPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Link Object</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.hwrberlin.remo.model.impl.LinkObjectImpl#getLinkname <em>Linkname</em>}</li>
 *   <li>{@link de.hwrberlin.remo.model.impl.LinkObjectImpl#getLinkstate <em>Linkstate</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class LinkObjectImpl extends EObjectImpl implements LinkObject {
	/**
	 * The default value of the '{@link #getLinkname() <em>Linkname</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLinkname()
	 * @generated
	 * @ordered
	 */
	protected static final String LINKNAME_EDEFAULT = "";

	/**
	 * The cached value of the '{@link #getLinkname() <em>Linkname</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLinkname()
	 * @generated
	 * @ordered
	 */
	protected String linkname = LINKNAME_EDEFAULT;

	/**
	 * The default value of the '{@link #getLinkstate() <em>Linkstate</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLinkstate()
	 * @generated
	 * @ordered
	 */
	protected static final ElementState LINKSTATE_EDEFAULT = ElementState.FALSE;

	/**
	 * The cached value of the '{@link #getLinkstate() <em>Linkstate</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLinkstate()
	 * @generated
	 * @ordered
	 */
	protected ElementState linkstate = LINKSTATE_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected LinkObjectImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return RemoModelPackage.Literals.LINK_OBJECT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getLinkname() {
		return linkname;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLinkname(String newLinkname) {
		String oldLinkname = linkname;
		linkname = newLinkname;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, RemoModelPackage.LINK_OBJECT__LINKNAME, oldLinkname, linkname));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ElementState getLinkstate() {
		return linkstate;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLinkstate(ElementState newLinkstate) {
		ElementState oldLinkstate = linkstate;
		linkstate = newLinkstate == null ? LINKSTATE_EDEFAULT : newLinkstate;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, RemoModelPackage.LINK_OBJECT__LINKSTATE, oldLinkstate, linkstate));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case RemoModelPackage.LINK_OBJECT__LINKNAME:
				return getLinkname();
			case RemoModelPackage.LINK_OBJECT__LINKSTATE:
				return getLinkstate();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case RemoModelPackage.LINK_OBJECT__LINKNAME:
				setLinkname((String)newValue);
				return;
			case RemoModelPackage.LINK_OBJECT__LINKSTATE:
				setLinkstate((ElementState)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case RemoModelPackage.LINK_OBJECT__LINKNAME:
				setLinkname(LINKNAME_EDEFAULT);
				return;
			case RemoModelPackage.LINK_OBJECT__LINKSTATE:
				setLinkstate(LINKSTATE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case RemoModelPackage.LINK_OBJECT__LINKNAME:
				return LINKNAME_EDEFAULT == null ? linkname != null : !LINKNAME_EDEFAULT.equals(linkname);
			case RemoModelPackage.LINK_OBJECT__LINKSTATE:
				return linkstate != LINKSTATE_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (linkname: ");
		result.append(linkname);
		result.append(", linkstate: ");
		result.append(linkstate);
		result.append(')');
		return result.toString();
	}

} //LinkObjectImpl
